﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Netcached.Tests
{
    [TestClass]
    public class TestFlushDelete : BaseTestClass
    {
        [TestMethod]
        public void TestFlushAll()
        {
            string key = "TestFlushDelete.TestFlushAll";
            string value = "data";

            Client.Set(key, value);
            bool operationResult = Client.FlushAllEntries();

            var fetchedValue = Client.Get(key);
            Assert.IsTrue(operationResult);
            Assert.IsNull(fetchedValue);
        }

        [TestMethod]
        public void TestDelete()
        {
            string key = "TestFlushDelete.TestFlushAll";
            string value = "data";

            Client.Set(key, value);

            var fetchedValue = Client.Get(key);

            Client.Delete(key);

            var fetchedDeletedValue = Client.Get(key);

            Assert.IsNotNull(fetchedValue);
            Assert.IsNull(fetchedDeletedValue);
        }
    }
}
